Skip to content

feat: support Evolve custom config in genesis#13

Open
johnletey wants to merge 1 commit intomainfrom
evolve-genesis
Open

feat: support Evolve custom config in genesis#13
johnletey wants to merge 1 commit intomainfrom
evolve-genesis

Conversation

@johnletey
Copy link
Member

@johnletey johnletey commented Oct 23, 2025

Summary by CodeRabbit

  • New Features
    • Added evolve configuration support to genesis blocks with mintAdmin address specification
    • Enhanced chain configuration to accommodate evolve parameters for devnet environments
    • Genesis structure now includes evolve configuration section for additional chain settings

@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

Walkthrough

The PR introduces Evolve configuration support to the devnet genesis system by adding a new config.evolve section with a mintAdmin address, along with wrapper types to encapsulate this configuration alongside existing chain parameters and custom JSON marshaling logic.

Changes

Cohort / File(s) Summary
Genesis Configuration
devnet/applayer/genesis.json
Adds config.evolve.mintAdmin field set to 0xfc28736049e1ea4a315bfc4cfc6e09240250dfdf in the genesis configuration.
Genesis Types & Marshaling
genutil/types.go
Introduces three new wrapper types: ChainConfigWithEvolve wrapping *params.ChainConfig with optional Evolve field, GenesisWithEvolve wrapping *core.Genesis with Config field, and EvolveChainConfig holding BaseFeeSink and MintAdmin addresses. Adds custom MarshalJSON method for GenesisWithEvolve to handle JSON serialization with proper type conversions.
Genesis Generation Logic
genutil/main.go
Refactors genesis generation: ChainConfig function now accepts mintAdmin parameter and returns *ChainConfigWithEvolve; DefaultDevnetGenesisBlock returns *GenesisWithEvolve instead of *core.Genesis; introduces authority-based genesis allocation with updated Config wiring using the new wrapper structure.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes introduce new wrapper types and refactor existing APIs across multiple files with custom JSON marshaling logic. While the structural modifications are straightforward, understanding the type hierarchy, verifying the JSON serialization correctness, and confirming API compatibility requires moderate analytical effort.

Possibly related PRs

Suggested reviewers

  • g-luca

Poem

🐰 Hops excitedly

A genesis evolves, with admin so mint,
Wrapped types cascade with elegant glint,
From genesis.json to marshaled display,
New configs blossom in every array! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: support Evolve custom config in genesis" directly aligns with the main changes in the changeset. The PR introduces wrapper types (ChainConfigWithEvolve, GenesisWithEvolve, EvolveChainConfig), updates the ChainConfig API to accept a mintAdmin parameter, and adds custom JSON marshaling logic to support the new Evolve configuration structure in the genesis block. The title is specific and concise, clearly indicating the primary change without vague terminology or unnecessary detail, making it immediately understandable for someone reviewing the git history.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch evolve-genesis

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
genutil/types.go (1)

32-74: Harden MarshalJSON: require non-nil Config and default empty alloc map.

Avoid emitting "config": null or "alloc": null in edge paths. Fail fast if Config is missing and serialize empty alloc as {}.

Apply this diff:

--- a/genutil/types.go
+++ b/genutil/types.go
@@
 import (
 	"encoding/json"
+	"fmt"
@@
 func (g GenesisWithEvolve) MarshalJSON() ([]byte, error) {
 	type Genesis struct {
@@
 	}
 	var enc Genesis
-	enc.Config = g.Config
+	enc.Config = g.Config
+	if enc.Config == nil {
+		return nil, fmt.Errorf("genesis config is required")
+	}
@@
-	if g.Alloc != nil {
-		enc.Alloc = make(map[common.UnprefixedAddress]coretypes.Account, len(g.Alloc))
-		for k, v := range g.Alloc {
-			enc.Alloc[common.UnprefixedAddress(k)] = v
-		}
-	}
+	if g.Alloc == nil {
+		enc.Alloc = map[common.UnprefixedAddress]coretypes.Account{}
+	} else {
+		enc.Alloc = make(map[common.UnprefixedAddress]coretypes.Account, len(g.Alloc))
+		for k, v := range g.Alloc {
+			enc.Alloc[common.UnprefixedAddress(k)] = v
+		}
+	}

Optionally, add ,omitempty to BaseFee/ExcessBlobGas/BlobGasUsed if you prefer to omit nulls.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da3e731 and 669bb8c.

📒 Files selected for processing (3)
  • devnet/applayer/genesis.json (1 hunks)
  • genutil/main.go (1 hunks)
  • genutil/types.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
genutil/types.go (1)
genutil/main.go (1)
  • ChainConfig (15-48)
genutil/main.go (1)
genutil/types.go (4)
  • ChainConfigWithEvolve (15-18)
  • EvolveChainConfig (27-30)
  • GenesisWithEvolve (21-24)
  • Genesis (35-51)
🔇 Additional comments (6)
genutil/types.go (1)

14-30: Wrapper types for Evolve support are clear and minimal.

Struct embedding and JSON tags look good; the optional Evolve block matches the intended schema.

genutil/main.go (4)

15-47: ChainConfig wiring LGTM.

Defaults match the committed JSON (IDs, hardfork heights/times, blob schedule). Evolve.MintAdmin plumbs through cleanly.


52-59: Genesis header fields align with genesis.json.

GasLimit 60,000,000 and Timestamp 1,758,708,000 (0x68d3c120) match the JSON. No issues.


81-82: Config is sourced from ChainConfig(Devnet, &authority).

Good — this prevents drift between alloc’s authority and evolve.mintAdmin.


66-76: This review comment is factually incorrect about the Solidity short-string encoding specification.

For Solidity short strings (≤31 bytes), the least significant byte should be len*2 with the low bit = 0, not len*2 + 1. The len*2 + 1 encoding (with low bit = 1) is reserved for long strings (>31 bytes).

The current implementation in genutil/main.go:147 is correct:

value[31] = byte(len(bz) * 2)

For your example: "Wrapped Noble" (13 bytes) → 13*2 = 0x1a (binary: 0001_1010, low bit = 0) is the correct encoding. Setting it to 0x1b (low bit = 1) would incorrectly signal a long string layout.

The codebase requires no changes. Disregard the suggested refactoring.

Likely an incorrect or invalid review comment.

devnet/applayer/genesis.json (1)

33-36: All verifications passed — addresses are consistent across config, code, and alloc.

The checks confirm:

  • config.evolve.mintAdmin matches the authority address in code
  • alloc includes the authority address (unprefixed) as a key

No issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant